#include <stdio.h>
#include <string.h>
#include <iostream>
#include <stdlib.h>
#include "Tokenizer.h"
using namespace std;

void Tokenizer::TokenizeString(string stringToTokenize, int **tokens, string delimiters, int *count)
{
        *count = 0;
        char * token;
        
        for(int i = 0; i < stringToTokenize.length(); i++)
        {
                if(stringToTokenize[i] == delimiters[0])
                {
                        (*count)++;
                }
        }
        
        (*count)++;
        *tokens = new int[*count];
        int* t = *tokens;
        int i = 0;
        
        token = strtok (const_cast<char *>(stringToTokenize.c_str()),delimiters.c_str());
        while (token != NULL)
        {

 
                        (*tokens)[i] = atoi(token);
                        i++;
                
                token = strtok (NULL, delimiters.c_str());
        }
        
        return;
}
